package com.fuyu.system.models.vo.user;

import com.fuyu.system.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;

import java.util.Date;

@Tag(name = "用户基本信息")
@Data
public class SysUserBaseInfoVO {

    @Schema(description = "部门ID")
    private Long deptId;
    //登录账号
    @Schema(description = "登录账号")
    private String username;

    //用户昵称
    @Schema(description = "用户昵称")
    private String nickname;

    //头像路径
    @Schema(description = "头像路径")
    private String avatar;

    //用户类型（00系统用户 01注册用户）
    @Schema(description = "用户类型（00系统用户 01注册用户）")
    private String userType;

    //用户邮箱
    @Schema(description = "用户邮箱")
    private String email;

    //手机号码
    @Schema(description = "手机号码")
    private String phone;

    //用户性别（0男 1女 2未知）
    @Schema(description = "用户性别（0男 1女 2未知）")
    private String gender;

    //帐号状态（0正常 1停用）
    @Schema(description = "帐号状态（0正常 1停用）")
    private String status;

    //最后登录时间
    @Schema(description = "最后登录时间")
    private Date loginDate;

    //密码最后更新时间
    @Schema(description = "密码最后更新时间")
    private Date pwdUpdateDate;

    //备注
    @Schema(description = "备注")
    private String remark;


    public static SysUserBaseInfoVO toVO(SysUser sysUser) {
        SysUserBaseInfoVO sysUserBaseInfoVO = new SysUserBaseInfoVO();

        sysUserBaseInfoVO.setDeptId(sysUser.getDeptId());
        sysUserBaseInfoVO.setUsername(sysUser.getUsername());
        sysUserBaseInfoVO.setNickname(sysUser.getNickname());
        sysUserBaseInfoVO.setAvatar(sysUser.getAvatar());
        sysUserBaseInfoVO.setUserType(sysUser.getUserType());
        sysUserBaseInfoVO.setEmail(sysUser.getEmail());
        sysUserBaseInfoVO.setPhone(sysUser.getPhone());
        sysUserBaseInfoVO.setGender(sysUser.getGender());
        sysUserBaseInfoVO.setStatus(sysUser.getStatus());
        sysUserBaseInfoVO.setLoginDate(sysUser.getLoginDate());

        return sysUserBaseInfoVO;
    }

}
